home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Views / Sources / UODPartView.cp < prev    next >
Encoding:
Text File  |  1996-04-03  |  22.7 KB  |  753 lines  |  [TEXT/CWIE]

  1. //----------------------------------------------------------------------------------------
  2. // UODPartView.cp
  3. // Copyright © 1994-96 by Apple Computer, Inc. All rights reserved.
  4. //----------------------------------------------------------------------------------------
  5.  
  6. #if qContainer
  7.  
  8. #ifndef __UODPARTVIEW__
  9. #include "UODPartView.h"
  10. #endif
  11.  
  12. #ifndef __UINSERTPARTCOMMAND__
  13. #include "UInsertPartCommand.h"
  14. #endif
  15.  
  16. #ifndef __UODPARTVIEWCOMMANDS__
  17. #include "UODPartViewCommands.h"
  18. #endif
  19.  
  20. // MacApp
  21.  
  22. #ifndef __UCOREGLOBALS__
  23. #include "UCoreGlobals.h"
  24. #endif
  25.  
  26. #ifndef __UFILEBASEDDOCUMENT__
  27. #include "UFileBasedDocument.h"
  28. #endif
  29.  
  30. #ifndef __ULISTITERATOR__
  31. #include "UListIterator.h"
  32. #endif
  33.  
  34. #ifndef __UMACAPPGLOBALS__
  35. #include "UMacAppGlobals.h"
  36. #endif
  37.  
  38. #ifndef __UVIEW__
  39. #include "UView.h"
  40. #endif
  41.  
  42. //only temporary!!!•••
  43. const CommandNumber cInsertPart     = 6661; 
  44. const CommandNumber cCopyODPart     = 6662; 
  45. const CommandNumber cCutODPart         = 6663; 
  46. const CommandNumber cPasteODPart     = 6664; 
  47.  
  48.  
  49. //========================================================================================
  50. // CLASS TODPartView
  51. //========================================================================================
  52. #undef Inherited
  53. #define Inherited TView
  54.  
  55. #pragma segment ASelCommand
  56. MA_DEFINE_CLASS_M1(TODPartView, Inherited);
  57.  
  58. //----------------------------------------------------------------------------------------
  59. // Constructor
  60. //----------------------------------------------------------------------------------------
  61. #pragma segment ARes
  62.  
  63. TODPartView::TODPartView()
  64.             : fSizePartToView(TRUE),
  65.               fCachedOrigin(0,0),
  66.               fFrameRef(NULL),
  67.               fHasPart(FALSE)
  68.               
  69. {
  70. }
  71.  
  72. //----------------------------------------------------------------------------------------
  73. // Destructor
  74. //----------------------------------------------------------------------------------------
  75. #pragma segment MADestructorRes
  76.  
  77. TODPartView::~TODPartView()
  78. {
  79.     fContainerDocument->DeleteODPartView(this);
  80.     // •••  What do we need to do about the fFrameRef here?
  81. }
  82.  
  83. //----------------------------------------------------------------------------------------
  84. // TODPartView::IODPartShape
  85. //----------------------------------------------------------------------------------------
  86. #pragma segment ARes
  87.               
  88. void TODPartView::IODPartView(TDocument* itsDocument,
  89.                                    TView* itsSuperView,
  90.                                     const VPoint& itsLocation,
  91.                                     const VPoint& itsSize,
  92.                                    SizeDeterminer itsHSizeDet,
  93.                                     SizeDeterminer itsVSizeDet,
  94.                                     CAFrameRef frameRef)
  95. {    
  96.     this->IView(itsDocument,itsSuperView,itsLocation,itsSize,itsHSizeDet,itsVSizeDet);
  97.  
  98.     fContainerDocument = MA_DYNAMIC_CAST(TFileBasedDocument,itsDocument);
  99.     
  100.     if (fContainerDocument)
  101.     {
  102.         fContainerDocument->AddODPartView(this);
  103.     
  104.         if(fHasPart)
  105.         {
  106.             //Commmand knows about the frameRef
  107.             fFrameRef = frameRef;
  108.             fCachedOrigin = itsLocation;
  109.         
  110.             CADocumentRef        containerDoc = itsDocument->GetContainer();
  111.             RgnHandle            frameRgn = CAGetFrameRgn(containerDoc, frameRef);
  112.             CRect                theFrameRect((**frameRgn).rgnBBox);
  113.             
  114.             fSize = theFrameRect.GetSize();
  115.             DisposeRgn(frameRgn);
  116.         }
  117.     }
  118.     else
  119.     {
  120.         DebugStr("\pAttempting to Initialize a ODPartView with a non file-based document.");
  121.         Failure(minErr, 0);
  122.     } 
  123.  
  124. }
  125.  
  126. //----------------------------------------------------------------------------------------
  127. // TODPartView::DoPostCreate: 
  128. //----------------------------------------------------------------------------------------
  129. #pragma segment AOpen
  130.     
  131. void TODPartView::DoPostCreate(TDocument* itsDocument) 
  132. {
  133.     TView::DoPostCreate(itsDocument);
  134.     
  135.     fContainerDocument = MA_DYNAMIC_CAST(TFileBasedDocument,itsDocument);
  136.     if(fContainerDocument)
  137.         fContainerDocument->AddODPartView(this);
  138.     else
  139.     {
  140.         DebugStr("\pAttempting to create a ODPartView with a non file-based document.");
  141.         Failure(minErr, 0);
  142.     }
  143.  
  144.  
  145. //----------------------------------------------------------------------------------------
  146. // TODPartView::ReadFrom
  147. //----------------------------------------------------------------------------------------
  148. #pragma segment AReadFile
  149.  
  150. void TODPartView::ReadFrom(TStream* aStream)
  151. {
  152.     TView::ReadFrom (aStream);
  153. }
  154.  
  155. //----------------------------------------------------------------------------------------
  156. // TODPartView::WriteTo
  157. //----------------------------------------------------------------------------------------
  158. #pragma segment AWriteFile
  159.  
  160. void TODPartView::WriteTo(TStream* aStream)
  161. {
  162.     TView::WriteTo (aStream);
  163. }
  164.  
  165. //----------------------------------------------------------------------------------------
  166. // TODPartView::Draw
  167. //----------------------------------------------------------------------------------------
  168. #pragma segment ARes
  169.  
  170. void TODPartView::Draw(const VRect& area)
  171. {
  172.     TView::Draw(area);
  173.  
  174.     if(fHasPart)
  175.     {
  176.         CADocumentRef            containerDoc = fContainerDocument->GetContainer();
  177.         CAVisFrame                visFrame = CAGetVisFrame(containerDoc, fFrameRef);
  178.         
  179.         if (visFrame)
  180.         {
  181.             CADrawFrame(visFrame, NULL);    // A region ought to be passed here in order to
  182.         }                                    // prevent redraw flickering.
  183.         
  184.     }
  185.  
  186. }
  187.  
  188. //----------------------------------------------------------------------------------------
  189. // TODPartView::GetFrameRef
  190. //----------------------------------------------------------------------------------------
  191. #pragma segment Main
  192.  
  193. CAFrameRef TODPartView::GetFrameRef() const
  194. {
  195.     return fFrameRef;
  196. }
  197.  
  198. //----------------------------------------------------------------------------------------
  199. // TODPartView::SetFrameRef
  200. //----------------------------------------------------------------------------------------
  201. #pragma segment Main
  202.  
  203. void TODPartView::SetFrameRef(CAFrameRef    newFrameRef)
  204. {
  205.     fFrameRef = newFrameRef;
  206. }
  207.  
  208.  
  209. //----------------------------------------------------------------------------------------
  210. // TODPartView::AquirePartFromFile
  211. //----------------------------------------------------------------------------------------
  212. #pragma segment Main
  213.  
  214. void TODPartView::AquirePartFromFile(FSSpec thePartFile)
  215. {
  216.     CADocumentRef    sourceDoc      = CAOpenDocument(&thePartFile, NULL, 0, 0);
  217.  
  218.     this->AquirePartFromDocument(sourceDoc);
  219.  
  220.     CACloseDocument(sourceDoc);
  221. }
  222.  
  223. //----------------------------------------------------------------------------------------
  224. // TODPartView::AquirePartFromDocument
  225. //----------------------------------------------------------------------------------------
  226. #pragma segment Main
  227.  
  228. void TODPartView::AquirePartFromDocument(CADocumentRef sourceDocument)
  229. {
  230.     CATransform        extTransform;
  231.     
  232.     CADocumentRef    destDocument = fContainerDocument->GetContainer();
  233.     CACloneKey        cloneKey      = CABeginClone(sourceDocument, destDocument, kCACloneAll);
  234.     CAFrameRef        newFrameRef  = CACloneFrameRef(NULL, sourceDocument, destDocument, TRUE, cloneKey);
  235.     CAEndClone(sourceDocument, destDocument, cloneKey);
  236.  
  237.     this->SetFrameRef(newFrameRef);    
  238.     
  239.     VRect frameRect(GetFrame());
  240.     CRect theCRectFrame(frameRect.ToRect());
  241.     
  242.     CAVisFrame        visFrame     = CAGetVisFrame(destDocument, fFrameRef);
  243.  
  244.     CAMoveTransformTo(&extTransform, theCRectFrame[topLeft]);
  245.     CAMakeVisFrame(destDocument,fFrameRef, NULL, &extTransform, NULL);
  246.     
  247.     //CAVisFrame        visFrame     = CAGetVisFrame(destDocument, fFrameRef);
  248.     //CADrawFrame     (visFrame,NULL);
  249.     CASetSelected     (visFrame, TRUE);         // Set the facet as selected, in place
  250.     
  251.     fHasPart = TRUE;
  252. }
  253.  
  254.  
  255. //----------------------------------------------------------------------------------------
  256. // TODPartView::SizePartToView
  257. //----------------------------------------------------------------------------------------
  258. #pragma segment Main
  259.  
  260. void TODPartView::SizePartToView()
  261. {
  262.     CADocumentRef    destDocument = fContainerDocument->GetContainer();
  263.  
  264.     //First, Adjust the Frame
  265.     RgnHandle newRgnForFrame = NewRgn();
  266.     
  267.     VRect theVisibleExtent(GetVisibleExtent());
  268.     CRect theCRectVisibleExtent = theVisibleExtent.ToRect();
  269.     
  270.     RectRgn(newRgnForFrame,theCRectVisibleExtent); 
  271.     CASetFrameRgn(destDocument,this->fFrameRef,newRgnForFrame);
  272.     
  273.     //Second, Update the Facet (visFrame)
  274.     CAVisFrame theVisFrame = CAGetVisFrame(destDocument,this->fFrameRef);
  275.     if(theVisFrame)
  276.     {
  277.         RgnHandle    newRgnForFacet = CAGetFrameRgn(destDocument,this->fFrameRef);
  278.         CAAdjustVisFrame(theVisFrame,newRgnForFacet,NULL);
  279.     }    
  280. }
  281.  
  282. //----------------------------------------------------------------------------------------
  283. // TODPartView::SizeViewToPart
  284. //----------------------------------------------------------------------------------------
  285. #pragma segment Main
  286.  
  287. void TODPartView::SizeViewToPart()
  288. {
  289.     //there is an adorner bug that makes this 
  290.     //look like it is not totally working, but it is.
  291.         
  292.     if(fHasPart)
  293.     {
  294.         CADocumentRef        containerDoc = fContainerDocument->GetContainer();
  295.         RgnHandle            frameRgn     = CAGetFrameRgn(containerDoc, fFrameRef);
  296.         CRect                theFrameRect((**frameRgn).rgnBBox);
  297.         
  298.         fSize = theFrameRect.GetSize();
  299.         this->ForceRedraw();
  300.         DisposeRgn(frameRgn);
  301.     }    
  302. }
  303.  
  304.  
  305. //----------------------------------------------------------------------------------------
  306. // TODPartView::NegotiateFrameChange(RgnHandle theRgn)
  307. //----------------------------------------------------------------------------------------
  308. #pragma segment Main
  309.  
  310. Boolean TODPartView::NegotiateFrameChange(RgnHandle theRgn)
  311. {
  312.  
  313. //•••NOTE!! This is not working, just a place holder with some ideas on how it might work.
  314.  
  315.  
  316.     Boolean grantedRequest = FALSE;
  317.     
  318.     if(!fRejectFrameChangeRequests || !(fSizeDeterminer[vSel] == sizeFixed &&
  319.              fSizeDeterminer[hSel] == sizeFixed) || !fSizePartToView)
  320.     {        
  321.         if(fSizeDeterminer[vSel] == sizeVariable && fSizeDeterminer[hSel] == sizeVariable)
  322.         {
  323.             //we are size variable, so resize to the size of the frame
  324.             grantedRequest = TRUE;
  325.             this->SetFrame((**theRgn).rgnBBox, TRUE);
  326.         }
  327.         else
  328.         if(fSizeDeterminer[vSel] == sizeVariable && !(fSizeDeterminer[hSel] == sizeVariable))
  329.         {
  330.             grantedRequest = FALSE;
  331.             //adjust the region
  332.             //this->SetFrame((**rgn).BBox, TRUE)
  333.         }
  334.         else
  335.         if(!(fSizeDeterminer[vSel] == sizeVariable) && fSizeDeterminer[hSel] == sizeVariable)
  336.         {
  337.             grantedRequest = FALSE;
  338.             //adjust the region
  339.             //this->SetFrame((**rgn).BBox, TRUE)
  340.         }
  341.     }
  342.     
  343.     if(grantedRequest == FALSE)
  344.     {
  345.         RgnHandle newRgnForFrame = NewRgn();
  346.     
  347.         VRect theVisibleExtent = this->GetVisibleExtent();
  348.         CRect theCRectVisibleExtent = theVisibleExtent.ToRect();
  349.     
  350.         RectRgn(newRgnForFrame,theCRectVisibleExtent); 
  351.         
  352.         theRgn = newRgnForFrame; 
  353.     }
  354.     
  355.     return grantedRequest;
  356. }
  357.  
  358.  
  359. //----------------------------------------------------------------------------------------
  360. // TODPartView::RemovePart()
  361. //----------------------------------------------------------------------------------------
  362. #pragma segment Main
  363.  
  364. void TODPartView::RemovePart()
  365. {
  366.     CADocumentRef    containerDoc     = fContainerDocument->GetContainer();
  367.     CAFrameRef        frameRef         = this->GetFrameRef();
  368.     RgnHandle         oldFrameRegion     = CAGetFrameRgn(containerDoc,frameRef);
  369.     
  370.     CAVisFrame        oldVisFrame = CAGetVisFrame(containerDoc, frameRef);
  371.     CARemoveVisFrame(oldVisFrame); 
  372.     CARemoveFrameRef(containerDoc,frameRef);
  373.  
  374.     this->InvalidateRegion(oldFrameRegion);
  375.     
  376.     this->fHasPart = FALSE;
  377. }
  378.  
  379. //----------------------------------------------------------------------------------------
  380. // TODPartView::HasPart()
  381. //----------------------------------------------------------------------------------------
  382. #pragma segment Main
  383.  
  384. Boolean TODPartView::HasPart()
  385. {
  386.     return fHasPart;
  387. }
  388.  
  389. //----------------------------------------------------------------------------------------
  390. // TODPartView::SetFrame
  391. //----------------------------------------------------------------------------------------
  392. #pragma segment AClipboard
  393.  
  394. void TODPartView::SetFrame(const VRect& newFrame, Boolean invalidate)
  395. {
  396.     TView::SetFrame(newFrame, invalidate);
  397.     
  398.     if(fSizePartToView)
  399.         this->SizePartToView();
  400. }
  401.  
  402. //----------------------------------------------------------------------------------------
  403. // TODPartView::DoKeyEvent
  404. //----------------------------------------------------------------------------------------
  405. void TODPartView::DoKeyEvent(TToolboxEvent* event)// override 
  406. {
  407.  
  408.     Boolean handledCharacter = FALSE;
  409.  
  410.     if (this->IsEnabled() && this->HasPart())
  411.         if (event->fText == chFwdDelete || event->fText == chBackspace)
  412.         {
  413.             this->RemovePart();
  414.             handledCharacter = TRUE;
  415.         }
  416.             
  417.     if (!handledCharacter)
  418.         Inherited::DoKeyEvent(event);
  419. } // TODPartView::DoKeyEvent 
  420.  
  421.  
  422. //----------------------------------------------------------------------------------------
  423. // TODPartView::DoSetupMenus
  424. //----------------------------------------------------------------------------------------
  425. #pragma segment ARes
  426.             
  427. void TODPartView::DoSetupMenus()
  428. {
  429.     Inherited::DoSetupMenus();
  430.     
  431.     Enable(cInsertPart, TRUE);
  432.  
  433.     Enable(cPaste,TRUE); //•• use CanPaste method
  434.     
  435.     if(fHasPart)
  436.     {
  437.         
  438.         Enable(cODGetPartInfo,TRUE); //<- this should only be enabled if it has a part and the part 
  439.                                      // is not "active", since there is not sence of selection in the
  440.                                      // view....
  441.         //Enable(cODViewAsWindow,TRUE); //bug in CALib will crash your machine.....enable with warning.
  442.           Enable(cCut,TRUE);
  443.           Enable(cCopy,TRUE);
  444.     }
  445.  
  446.  
  447. //----------------------------------------------------------------------------------------
  448. // TODPartView::DoMenuCommand
  449. //----------------------------------------------------------------------------------------
  450. #pragma segment ASelCommand
  451.  
  452. void TODPartView::DoMenuCommand(CommandNumber aCommandNumber)
  453. {
  454.  
  455.     switch (aCommandNumber) 
  456.     {
  457.         case cCopy :
  458.             TCopyODPartCommand* theCopyPartCommand = new TCopyODPartCommand;
  459.             theCopyPartCommand->ICopyODPartCommand(cCopyODPart,this->fContainerDocument, this);
  460.             this->PostCommand(theCopyPartCommand);
  461.             break;
  462.             
  463.         case cCut :
  464.                 TCutODPartCommand* theCutPartCommand = new TCutODPartCommand;
  465.                 theCutPartCommand->ICutODPartCommand(cCutODPart,this->fContainerDocument, this);
  466.                 this->PostCommand(theCutPartCommand);
  467.             break;
  468.                 
  469.         case cPaste :
  470.                 TPasteODPartCommand* thePasteCommand = new TPasteODPartCommand;
  471.                 thePasteCommand->IPasteODPartCommand(cPasteODPart,this->fContainerDocument, this);
  472.                 this->PostCommand(thePasteCommand);
  473.             break;
  474.             
  475.          case cInsertPart:
  476.             {
  477.                 TInsertPartCommand* command = new TInsertPartCommand;
  478.                 if (command->IInsertPartCommand(aCommandNumber, this->fContainerDocument, this))
  479.                     this->PostCommand(command);
  480.                 else
  481.                     command = (TInsertPartCommand*) FreeIfObject(command);
  482.             }
  483.             break;
  484.  
  485.         case cODGetPartInfo :
  486.             //•••Bug in CALib
  487.             CADocumentRef    containerDoc     = fContainerDocument->GetContainer();
  488.             CAVisFrame        visFrame = CAGetVisFrame(containerDoc, this->fFrameRef);
  489.             CAShowPartFrameInfo(containerDoc, visFrame);
  490.             FailOSErr(CAError());
  491.             break;
  492.         
  493.         case cODViewAsWindow :
  494.              //•••Bug in CALib
  495.             //CAViewFrameInWindow(containerDoc,frameRef);
  496.             break;
  497.             
  498.         default:
  499.             Inherited::DoMenuCommand(aCommandNumber);
  500.             break;
  501.     }
  502.     
  503. } // TODPartView::DoMenuCommand 
  504.  
  505. #if qDrag
  506. //----------------------------------------------------------------------------------------
  507. // TODPartView::WillAcceptDrop
  508. //----------------------------------------------------------------------------------------
  509. #pragma segment MADragNonRes
  510.  
  511. Boolean TODPartView::WillAcceptDrop(CDragItemIterator& dragItemIterator)
  512. {
  513.     Boolean returnValue = FALSE;
  514.     
  515.     //we only accept one part per view
  516.     if (TDragDropSession::fgDragDropSession->GetItemCount() != 1)
  517.         return FALSE;
  518.         
  519.     TDragItem *firstItem = dragItemIterator.FirstDragItem();
  520.     
  521.     if(firstItem->FlavorExists('hfs ')) //flavorTypeHFS
  522.     {
  523.         Handle                dataHandle;
  524.         OSErr                theErr = noErr;
  525.         long                dataSize = 0;
  526.         HFSFlavor            theHFSFlavor;    
  527.         //CADocumentRef        sourceDoc;
  528.         
  529.         firstItem->FocusOnFlavor('hfs ');
  530.         dataHandle = firstItem->GetDataAsHandle();
  531.     
  532.         BlockMoveData( *dataHandle, &theHFSFlavor, (long)sizeof(HFSFlavor) );
  533.  
  534.         if (theHFSFlavor.fileCreator == kODShellSignature)
  535.             returnValue = TRUE;
  536.         else
  537.             returnValue = FALSE;
  538.  
  539.     }
  540.     else
  541.         returnValue = FALSE;
  542.         
  543.     return returnValue;
  544.     
  545. } // TODPartView::WillAcceptDrop
  546.  
  547. //----------------------------------------------------------------------------------------
  548. // TODPartView::DoMakeDragDropCommand
  549. //----------------------------------------------------------------------------------------
  550. #pragma segment MADragNonRes
  551.  
  552. TCommand* TODPartView::DoMakeDragDropCommand(CommandNumber         itsCommandNumber,
  553.                                         CDragItemIterator&    dragItemIterator)
  554. {
  555.     TCommand         *returnCommand = NULL;
  556.     TCommandHandler *itsContext = this->GetContext(itsCommandNumber);
  557.     
  558.     switch(itsCommandNumber)
  559.     {
  560.         case cDrag:
  561.             break;
  562.             
  563.         case cDrop:
  564.             {
  565.                 OSErr                theErr = noErr;
  566.                 long                dataSize = 0;
  567.                 HFSFlavor            theHFSFlavor;
  568.  
  569.                 TDragItem    *firstItem = dragItemIterator.FirstDragItem();
  570.                 firstItem->FocusOnFlavor('hfs ');
  571.                 Handle         dataHandle = firstItem->GetDataAsHandle();
  572.                 BlockMoveData( *dataHandle, &theHFSFlavor, (long)sizeof(HFSFlavor) );
  573.  
  574.                 
  575.         
  576.                 TODPartViewCommand *dropCommand = new TODPartViewCommand;
  577.                 dropCommand->IODPartViewCommand(theHFSFlavor.fileSpec, this, itsCommandNumber,
  578.                                                 itsContext, kCantUndo, kDoesNotCauseChange,
  579.                                                 itsContext);
  580.                 returnCommand = dropCommand;
  581.             }
  582.             break;
  583.         
  584.         case cDragMove:
  585.             break;
  586.             
  587.         default:
  588.             returnCommand = Inherited::DoMakeDragDropCommand(itsCommandNumber, dragItemIterator);
  589.             break;
  590.     }
  591.     
  592.     return returnCommand;
  593. } // TODPartView::DoMakeDragDropCommand
  594.  
  595. #endif
  596.  
  597. //----------------------------------------------------------------------------------------
  598. // InitUODPartView: 
  599. //----------------------------------------------------------------------------------------
  600. #pragma segment DlgInit
  601.  
  602. void InitUODPartView()
  603. {
  604.     MA_REGISTER_CLASS(TODPartView);
  605.  
  606. //========================================================================================
  607. // CLASS TODPartViewCommand
  608. //========================================================================================
  609. #undef Inherited
  610. #define Inherited TCommand
  611.  
  612. #pragma segment MADragNonRes
  613. MA_DEFINE_CLASS_M1(TODPartViewCommand, Inherited);
  614.  
  615. //----------------------------------------------------------------------------------------
  616. // TODPartViewCommand::TODPartViewCommand
  617. //----------------------------------------------------------------------------------------
  618. #pragma segment MADragNonRes
  619.  
  620. TODPartViewCommand::TODPartViewCommand()
  621. {
  622.     fODPartView = NULL;
  623. } // TODPartViewCommand::TODPartViewCommand
  624.  
  625. //----------------------------------------------------------------------------------------
  626. // TODPartViewCommand::IODPartViewCommand
  627. //----------------------------------------------------------------------------------------
  628. #pragma segment MADragNonRes
  629.  
  630. void TODPartViewCommand::IODPartViewCommand(FSSpec            theFileSpec,
  631.                                         TODPartView*        thePartView,
  632.                                         CommandNumber        itsCommandNumber,
  633.                                         TCommandHandler*    itsContext,
  634.                                         Boolean                canUndo,
  635.                                         Boolean                causesChange,
  636.                                         TObject*            objectToNotify)
  637. {    
  638.     fFileSpec     = theFileSpec;
  639.     fODPartView = thePartView; 
  640.     this->ICommand(itsCommandNumber, itsContext, canUndo, causesChange, objectToNotify);
  641. } // TODPartViewCommand::IPictureCommand
  642.  
  643. //----------------------------------------------------------------------------------------
  644. // TODPartViewCommand::~TODPartViewCommand
  645. //----------------------------------------------------------------------------------------
  646. #pragma segment MADragNonRes
  647.  
  648. TODPartViewCommand::~TODPartViewCommand()
  649. {
  650. } // TODPartViewCommand::~TODPartViewCommand
  651.  
  652. //----------------------------------------------------------------------------------------
  653. // TODPartViewCommand::DoIt
  654. //----------------------------------------------------------------------------------------
  655. #pragma segment MADragNonRes
  656.  
  657. void TODPartViewCommand::DoIt()
  658. {
  659.     fODPartView->AquirePartFromFile(fFileSpec);
  660. } // TODPartViewCommand::DoIt
  661.  
  662.  
  663. //========================================================================================
  664. // CLASS CODPartViewIterator
  665. //========================================================================================
  666. #undef Inherited
  667. #define Inherited CObjectIterator
  668.  
  669. /*
  670. //----------------------------------------------------------------------------------------
  671. // CODPartViewIterator::CODPartViewIterator: 
  672. //----------------------------------------------------------------------------------------
  673. #pragma segment MAViewRes
  674.  
  675. CODPartViewIterator::CODPartViewIterator(const TFileBasedDocument* theFBDocument,
  676.                                                 ArrayIndex itsLowBound,
  677.                                                 ArrayIndex itsHighBound,
  678.                                                 Boolean itsForward)
  679. {
  680.     CObjectIterator(theFBDocument ? theFBDocument->fODPartViewList : NULL, itsLowBound, itsHighBound,itsForward);
  681. } // CODPartViewIterator::CODPartViewIterator 
  682. */
  683.  
  684. //----------------------------------------------------------------------------------------
  685. // CODPartViewIterator::CODPartViewIterator: 
  686. //----------------------------------------------------------------------------------------
  687. #pragma segment MAApplicationRes
  688.  
  689. CODPartViewIterator::CODPartViewIterator(TFileBasedDocument* theFBDocument,
  690.                                      Boolean itsForward) :
  691.     CObjectIterator(theFBDocument ? theFBDocument->fODPartViewList : NULL, itsForward)
  692. {
  693. } // CCADocumentIterator::CDocumentIterator 
  694.  
  695. //----------------------------------------------------------------------------------------
  696. // CODPartViewIterator::CODPartViewIterator: 
  697. //----------------------------------------------------------------------------------------
  698. #pragma segment MAApplicationRes
  699.  
  700. CODPartViewIterator::CODPartViewIterator(TFileBasedDocument* theFBDocument) :
  701.     CObjectIterator(theFBDocument ? theFBDocument->fODPartViewList : NULL, kIterateForward)
  702. {
  703. } // CODPartViewIterator::CODPartViewIterator 
  704.  
  705. //----------------------------------------------------------------------------------------
  706. // CODPartViewIterator::~CODPartViewIterator: 
  707. //----------------------------------------------------------------------------------------
  708. #pragma segment MAApplicationRes
  709.  
  710. CODPartViewIterator::~CODPartViewIterator() 
  711. {
  712. } // CODPartViewIterator::~CODPartViewIterator 
  713.  
  714. //----------------------------------------------------------------------------------------
  715. // CODPartViewIterator::CurrentODPartView: 
  716. //----------------------------------------------------------------------------------------
  717. #pragma segment MAApplicationRes
  718.  
  719. TODPartView* CODPartViewIterator::CurrentODPartView()
  720. {
  721.     return (TODPartView*)this->CurrentObject();
  722. } // CODPartViewIterator::CurrentODPartView 
  723.  
  724. //----------------------------------------------------------------------------------------
  725. // CCADocumentIterator::FirstDocument: 
  726. //----------------------------------------------------------------------------------------
  727. #pragma segment MAApplicationRes
  728.  
  729. TODPartView* CODPartViewIterator::FirstODPartView()
  730. {
  731.     return (TODPartView *)this->FirstObject();
  732. } // CCADocumentIterator::FirstDocument 
  733.  
  734. //----------------------------------------------------------------------------------------
  735. // CCADocumentIterator::NextDocument: 
  736. //----------------------------------------------------------------------------------------
  737. #pragma segment MAApplicationRes
  738.  
  739. TODPartView* CODPartViewIterator::NextODPartView()
  740. {
  741.     return (TODPartView *)this->NextObject();
  742. } // CCADocumentIterator::NextDocument 
  743.  
  744.  
  745. //----------------------------------------------------------------------------------------
  746. // End of UODPartView.cp
  747.  
  748. #endif //qContainer
  749. #pragma segment Inline
  750.